/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/13 13:51
  *
  * @file       pd_timer_etr.h
  * @brief      Header file of TimerETR peripheral driver.
  *
  * @note       This file contains the TimerETR object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/13     Chris        the first version
  *
  ******************************************************************************
  */

#ifndef JLC_SKY_TIMER_ETR_H
#define JLC_SKY_TIMER_ETR_H

#include "pd_timer.h"
#include "pd_timer_ch.h"
#include "drivers.h"

typedef struct TimerETRDef TimerETR;

struct TimerETRDef {
    Timer *timer;    /* Timer Base Unit              */
    TimerCh *timerChannel;

    uint32_t ETRPolarity;   /* External Trigger Polarity    */
    uint32_t ETRPrescaler;  /* External Trigger Pre-scaler  */
    uint32_t ETRFilter;     /* External Trigger Filter      */

    uint32_t ClockSource;

    void (*init)(TimerETR *this, IRQn_Type irQnType, uint32_t PreemptPriority, uint32_t SubPriority);
};

extern const struct TimerETRClass {
    TimerETR *(*build)(Timer *timer, TimerCh *timerChannel);
} TimerETRBuilder;

#endif //JLC_SKY_TIMER_ETR_H
